﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Compilex.Automata
{
    public class PredicateTransitionRule<S> : ITransitionRule<S>
    {
        public Predicate<string> Predicate { get; set; }
        public S Destination { get; set; }
        public bool IsEpsilon { get { return false; } }

        public PredicateTransitionRule(Predicate<string> predicate, S destination)
        {
            this.Predicate = predicate;
            this.Destination = destination;
        }

        public bool MatchesInput(string input)
        {
            return Predicate(input);
        }
    }
}
